package com.kly.smartbi.service.impl;

import cn.hutool.core.util.ObjUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kly.smartbi.common.ErrorCode;
import com.kly.smartbi.exception.ThrowUtils;
import com.kly.smartbi.mapper.QuestionSubmitMapper;
import com.kly.smartbi.model.dto.questionsubmit.QuestionSubmitAddRequest;
import com.kly.smartbi.model.dto.questionsubmit.QuestionSubmitQueryRequest;
import com.kly.smartbi.model.entity.QuestionSubmit;
import com.kly.smartbi.model.enums.QuestionSubmitLanguageEnum;
import com.kly.smartbi.model.vo.QuestionSubmitVO;
import com.kly.smartbi.service.QuestionSubmitService;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;

/**
 * @author admin
 * @description 针对表【question(题目表)】的数据库操作Service实现
 * @createDate 2025-04-15 16:38:03
 */
@Service
public class QuestionSubmitServiceImpl extends ServiceImpl<QuestionSubmitMapper, QuestionSubmit>
        implements QuestionSubmitService {

    @Override
    public void validQuestionSubmit(QuestionSubmit questionSubmit, boolean add) {

    }

    @Override
    public QueryWrapper<QuestionSubmit> getQueryWrapper(QuestionSubmitQueryRequest questionSubmitQueryRequest) {
        return null;
    }

    @Override
    public Page<QuestionSubmit> searchFromEs(QuestionSubmitQueryRequest questionSubmitQueryRequest) {
        return null;
    }

    @Override
    public QuestionSubmitVO getQuestionSubmitVO(QuestionSubmit questionSubmit, HttpServletRequest request) {
        return null;
    }

    @Override
    public Page<QuestionSubmitVO> getQuestionSubmitVOPage(Page<QuestionSubmit> questionSubmitPage, HttpServletRequest request) {
        return null;
    }

    @Override
    public Long addQuestionSubmit(QuestionSubmitAddRequest questionSubmitAddRequest) {
        ThrowUtils.throwIf(ObjUtil.isNull(questionSubmitAddRequest), ErrorCode.PARAMS_ERROR);
        Long id = questionSubmitAddRequest.getId();
        String language = questionSubmitAddRequest.getLanguage();
        String code = questionSubmitAddRequest.getCode();
        String judgeInfo = questionSubmitAddRequest.getJudgeInfo();
        Long questionId = questionSubmitAddRequest.getQuestionId();
        // 获取语言
        QuestionSubmitLanguageEnum questionSubmitLanguageEnum = QuestionSubmitLanguageEnum.fromValue(language);
        ThrowUtils.throwIf(ObjUtil.isNull(questionSubmitLanguageEnum), ErrorCode.PARAMS_ERROR, "不支持的编程语言");
        return 0L;
    }
}




